<template>
	<view class="box">
		<view class="box-cen">
			<view class="box-text">
				<timeLine :list="list"></timeLine>
			</view>
		</view>
	</view>
</template>

<script>
	const meetingMap = {
		id: {
			type:'text',
			name: '序号',
			filter: (val) => val
		},
		type: {
			type:'text',
			name: '类型',
			filter: (val) => val
		},
		name: {
			type:'text',
			name: '案例名称',
			filter: (val) => val
		},
		detail: {
			type:'text',
			name: '案例描述',
			filter: (val) => val
		},
		reason: {
			type:'text',
			name: '原因分析',
			filter: (val) => val
		},
		audit: {
			type:'text',
			name: '审核依据',
			filter: (val) => val
		},
		workaround: {
			type:'text',
			name: '解决方法',
			filter: (val) => val
		},
		suggestion: {
			type:'text',
			name: '管理建议',
			filter: (val) => val
		},
		pic2_file_id: {
			type: 'image',
			name: '描述图片',
			filter: val => {
				return [
					{
						url: val
					}
				]
			}
		}
		
	}
	import timeLine from '@/components/time_line/index.vue';
	import {
		SettlementCaseDetail
	} from '@/api/patrol.js';
	import {
		mapGetters,
		mapActions
	} from 'vuex';
	export default {
		components: {
			timeLine
		},
		data() {
			return {
				name: '',
				id: '',
				list: [],
				curd: 0,
				form: {},
				type: 'add',
				info: {},
			};
		},
		methods: {
			async fetchData() {
				uni.showLoading({
					title: '加载中...'
				});
				const {
					data
				} = await SettlementCaseDetail({
					id:this.id
				});
				// console.log(data)
				uni.hideLoading();
				if (data.code === 1) {
					let arr = []
					let res = data.data
					for (let key in meetingMap) {
						let item = {}
						if (meetingMap[key]) {
							var type = meetingMap[key].type
							item = {
								title: meetingMap[key].name,
								content: {
									type: type,
									value: meetingMap[key].filter(res[key])
								}
							}
							if (res[key] != null && res[key] != '') {
								arr.push(item)
							}
						}
					}
					this.list = arr
				}
			}
		},
		onLoad(data) {
			this.id = data.id
		},
		onReady() {
			this.fetchData();
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 100%;
		height: 100rpx;
		background-color: #2658FA;
		.box-cen {
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			background-color: #fff;
			.box-text{
				padding: 50rpx 30rpx;
			}
		}
	}

</style>
